﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/AdminMaster.Master"
    AutoEventWireup="true" CodeBehind="EditUsers.aspx.cs" Inherits="whatpricemyhouse.Admin.EditUsers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div>
        <div>
            General user information</div>
        <p>
        </p>
        <table cellpadding="2">
            <tr>
                <td width="130">
                    UserName:
                </td>
                <td width="300">
                    <asp:Literal runat="server" ID="lblUserName" />
                </td>
            </tr>
            <tr>
                <td>
                    E-mail address:
                </td>
                <td>
                    <asp:HyperLink ID="lnkEmailAddress" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    Registered:
                </td>
                <td>
                    <asp:Literal ID="lblRegistered" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    Last Login:
                </td>
                <td>
                    <asp:Literal ID="lblLastLogin" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    Last Activity:
                </td>
                <td>
                    <asp:Literal ID="lblLastActivity" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    Online Now:
                </td>
                <td>
                    <asp:CheckBox ID="chkIsOnlineNow" Enabled="false" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    Approved:
                </td>
                <td>
                    <asp:CheckBox ID="chkIsApproved" AutoPostBack="true" OnCheckedChanged="chkIsApproved_CheckedChanged"
                        runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    Locked Out:
                </td>
                <td>
                    <asp:CheckBox ID="chkIsLockedOut" AutoPostBack="true" OnCheckedChanged="chkIsLockedOut_CheckedChanged"
                        runat="server" />
                </td>
            </tr>
        </table>
        <p>
        </p>
        <asp:CheckBoxList runat="server" ID="chklRoles" RepeatColumns="5" 
            CellSpacing="4" Visible="False" />
                    <asp:Label runat="server" ID="lblRolesOK"
                        Visible="False" />
                    <asp:Button ID="btnUpdate" Text="Update" OnClick="btnUpdate_Click" 
            runat="server" Visible="False" />
        <hr />
        <div>
            Edit agent area<br />
            <br />
            Current Setting<br />
            City:
            <asp:Label ID="RegionLabel" runat="server"></asp:Label>
&nbsp;&nbsp;
            <br />
            Place:
            <asp:Label ID="PlaceLabel" runat="server"></asp:Label>
            <br />
            PostCode:
            <asp:Label ID="PostcodeLabel" runat="server"></asp:Label>
        </div>
        <p>
            City:
            <asp:DropDownList ID="RegionSelector" runat="server" AutoPostBack="True" 
                DataSourceID="SqlDataSource1" DataTextField="area" DataValueField="area">
            </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:WhatPriceMyHouseConnectionString %>" 
                SelectCommand="SELECT DISTINCT area FROM suburbs WHERE (area &lt;&gt; '') ORDER BY area">
            </asp:SqlDataSource>
&nbsp;Place:
            <asp:DropDownList ID="PlaceSelector" runat="server" 
                DataSourceID="SqlDataSource2" DataTextField="suburb" 
                DataValueField="suburbid" AutoPostBack="True">
            </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:WhatPriceMyHouseConnectionString %>" 
                SelectCommand="SELECT suburb, suburbid FROM suburbs WHERE (area = @area) ORDER BY suburb">
                <SelectParameters>
                    <asp:ControlParameter ControlID="RegionSelector" DefaultValue="" Name="area" 
                        PropertyName="SelectedValue" />
                </SelectParameters>
            </asp:SqlDataSource>
        </p>
        <p>
            Agent List
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
                DataKeyNames="UserID" DataSourceID="SqlDataSource3" 
                EnableModelValidation="True" ForeColor="#333333" GridLines="None">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:BoundField DataField="FirstName" HeaderText="Agent Name" 
                        SortExpression="FirstName" />
                    <asp:BoundField DataField="Mobile" HeaderText="Mobile" 
                        SortExpression="Mobile" />
                    <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
                </Columns>
                <EditRowStyle BackColor="#999999" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                ConnectionString="<%$ ConnectionStrings:WhatPriceMyHouseConnectionString %>" 
                SelectCommand="SELECT agent_info_table.* FROM agent_info_table INNER JOIN place_agent_table ON agent_info_table.UserID = place_agent_table.UserID WHERE (place_agent_table.suburbid = @suburbid)">
                <SelectParameters>
                    <asp:ControlParameter ControlID="PlaceSelector" 
                        Name="suburbid" PropertyName="SelectedValue" />
                </SelectParameters>
            </asp:SqlDataSource>
        </p>
        <table cellpadding="2" width="400">
            <tr>
                <td align="right">
                    <asp:Label ID="lblProfileOK" Text="Agent area was successfully updated" Visible="False"
                        runat="server" ForeColor="#CC0000" />
                    <asp:Button ID="btnUpdateProfile" Text="Update" runat="server" ValidationGroup="EditProfile"
                        OnClick="btnUpdateProfile_Click" />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
